home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / OldSrc / CH2 / SRC / RECT.FRM < prev    next >
Text File  |  1995-12-20  |  2KB  |  68 lines

  1. VERSION 4.00
  2. Begin VB.Form RectForm 
  3.    AutoRedraw      =   -1  'True
  4.    Caption         =   "Rectangle and RoundRect"
  5.    ClientHeight    =   4140
  6.    ClientLeft      =   1350
  7.    ClientTop       =   1770
  8.    ClientWidth     =   6690
  9.    Height          =   4830
  10.    Left            =   1290
  11.    LinkTopic       =   "RectForm"
  12.    ScaleHeight     =   276
  13.    ScaleMode       =   3  'Pixel
  14.    ScaleWidth      =   446
  15.    Top             =   1140
  16.    Width           =   6810
  17.    Begin VB.Menu mnuFile 
  18.       Caption         =   "&File"
  19.       Begin VB.Menu mnuFileExit 
  20.          Caption         =   "E&xit"
  21.       End
  22.    End
  23. End
  24. Attribute VB_Name = "RectForm"
  25. Attribute VB_Creatable = False
  26. Attribute VB_Exposed = False
  27. Option Explicit
  28.  
  29.  
  30. Private Sub Form_Resize()
  31. Dim hgt As Integer
  32. Dim dh As Integer
  33. Dim wid As Integer
  34. Dim dw As Integer
  35. Dim ymid As Integer
  36. Dim xmid As Integer
  37. Dim i As Integer
  38. Dim s As Integer
  39. Dim round As Boolean
  40.  
  41.     Cls
  42.     hgt = ScaleHeight * 0.1
  43.     dh = ScaleHeight * 0.4 / 5
  44.     wid = ScaleWidth * 0.5
  45.     dw = -ScaleWidth * 0.4 / 5
  46.     ymid = ScaleHeight / 2
  47.     xmid = ScaleWidth / 2
  48.     
  49.     For i = 1 To 5
  50.         If round Then
  51.             s = RoundRect(hDC, xmid - wid, ymid - hgt, xmid + wid, ymid + hgt, 50, 30)
  52.         Else
  53.             s = Rectangle(hDC, xmid - wid, ymid - hgt, xmid + wid, ymid + hgt)
  54.         End If
  55.         round = Not round
  56.         
  57.         wid = wid + dw
  58.         hgt = hgt + dh
  59.     Next i
  60.     Refresh
  61. End Sub
  62.  
  63.  
  64. Private Sub mnuFileExit_Click()
  65.     Unload Me
  66. End Sub
  67.  
  68.